HAL HRTIM function migration

This section provides information about the HAL HRTIM function migration.

Configures the ADC post scaler for HRTIM.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_ADCPostScalerConfig(HRTIM_HandleTypeDef *hhrtim,
                                                uint32_t ADCTrigger,
                                                uint32_t Postscaler);
hal_status_t HAL_HRTIM_SetADCPostscaler(hal_hrtim_handle_t *hhrtim,
                                        hal_hrtim_adc_trigger_t adc_trigger,
                                        uint8_t postscaler);

Configures the ADC trigger for HRTIM.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_ADCTriggerConfig(HRTIM_HandleTypeDef *hhrtim,
                                             uint32_t ADCTrigger,
                                             const HRTIM_ADCTriggerCfgTypeDef *pADCTriggerCfg);
hal_status_t HAL_HRTIM_SetADCSynchro(hal_hrtim_handle_t *hhrtim,
                                     hal_hrtim_adc_trigger_t adc_trigger,
                                     const hal_hrtim_adc_sync_config_t *p_config);

Configures burst DMA for HRTIM.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_BurstDMAConfig(HRTIM_HandleTypeDef *hhrtim,
                                           uint32_t TimerIdx,
                                           uint32_t RegistersToUpdate);
hal_status_t HAL_HRTIM_SetConfigDMABurst(hal_hrtim_handle_t *hhrtim,
                                         const hal_hrtim_dmaburst_config_t *p_config);

Starts burst DMA transfer for HRTIM.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_BurstDMATransfer(HRTIM_HandleTypeDef *hhrtim,
                                             uint32_t TimerIdx,
                                             uint32_t BurstBufferAddress,
                                             uint32_t BurstBufferLength);
hal_status_t HAL_HRTIM_StartDMABurst(hal_hrtim_handle_t *hhrtim,
                                     hal_hrtim_dma_source_t source,
                                     const uint8_t *p_data,
                                     uint32_t size_byte);

Configures burst mode for HRTIM.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_BurstModeConfig(HRTIM_HandleTypeDef *hhrtim,
                                            const HRTIM_BurstModeCfgTypeDef *pBurstModeCfg);
hal_status_t HAL_HRTIM_SetConfigBurstMode(hal_hrtim_handle_t *hhrtim,
                                          const hal_hrtim_burst_mode_config_t *p_config);

Note

  • In HAL1, burst mode configuration is performed by calling HAL_HRTIM_BurstModeConfig, which uses a single configuration structure including the following parameters: Mode, ClockSource, Prescaler, PreloadEnable, Trigger, IdleDuration, and Period.

  • In HAL2, burst mode is configured using HAL_HRTIM_SetConfigBurstMode with a configuration structure that sets all parameters except preload. The preload feature is managed separately through the APIs:

    hal_status_t HAL_HRTIM_EnableBurstModePreload(hal_hrtim_handle_t *hhrtim);
    
    hal_status_t HAL_HRTIM_DisableBurstModePreload(hal_hrtim_handle_t *hhrtim);
    

    For more details, refer to Burst mode configuration structure


Controls burst mode operation.

HAL1

HAL2

In HAL1, burst mode is enabled or disabled using a single function with an enable/disable parameter.

In HAL2, burst mode is controlled by two distinct APIs

HAL_StatusTypeDef HAL_HRTIM_BurstModeCtl(HRTIM_HandleTypeDef *hhrtim,
                                         uint32_t Enable);
hal_status_t HAL_HRTIM_EnableBurstMode(hal_hrtim_handle_t *hhrtim); /* To enable burst mode */

hal_status_t HAL_HRTIM_DisableBurstMode(hal_hrtim_handle_t *hhrtim); /* To disable burst mode */

Triggers burst mode by software.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_BurstModeSoftwareTrigger(HRTIM_HandleTypeDef *hhrtim);
hal_status_t HAL_HRTIM_StartBurstMode(hal_hrtim_handle_t *hhrtim);

Configures chopper mode.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_ChopperModeConfig(HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t TimerIdx,
                                              const HRTIM_ChopperModeCfgTypeDef *pChopperModeCfg);
hal_status_t HAL_HRTIM_TIM_SetConfigChopper(hal_hrtim_handle_t *hhrtim,
                                            uint32_t timer,
                                            const hal_hrtim_chopper_config_t *p_config);

Polls for DLL calibration completion.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_PollForDLLCalibration(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t Timeout);
hal_status_t HAL_HRTIM_PollForDLLCalibration(hal_hrtim_handle_t *hhrtim,
                                             uint32_t timeout_ms);

Starts DLL calibration.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_DLLCalibrationStart(HRTIM_HandleTypeDef *hhrtim,
                                                uint32_t CalibrationRate);
hal_status_t HAL_HRTIM_StartPeriodicDLLCalibration(hal_hrtim_handle_t *hhrtim,
                                                   hal_hrtim_calibration_rate_t calibration_rate);

Starts DLL calibration with interrupt.

HAL1

HAL2

In HAL1, DLL calibration in interrupt mode is started using the following API:

HAL_StatusTypeDef HAL_HRTIM_DLLCalibrationStart_IT(HRTIM_HandleTypeDef *hhrtim,
                                                 uint32_t CalibrationRate);

In HAL2, this functionality is split into two steps:

  1. Configure the interrupt source and type.

  2. Start DLL calibration using the polling API.

To replicate the HAL1 behavior, configure the interrupt source HAL_HRTIM_INTERRUPT_COMMON and the interrupt HAL_HRTIM_OPT_IT_DLL_CALIBRATION as shown below:

/* Configure interrupts for DLL calibration */
hal_status_t HAL_HRTIM_SetConfigInterrupts(hal_hrtim_handle_t *hhrtim,
                                          HAL_HRTIM_INTERRUPT_COMMON,
                                          HAL_HRTIM_OPT_IT_DLL_CALIBRATION);

/* Start periodic DLL calibration */
hal_status_t HAL_HRTIM_StartPeriodicDLLCalibration(hal_hrtim_handle_t *hhrtim,
                                                  hal_hrtim_calibration_rate_t calibration_rate);

Configures dead time.

HAL1

HAL2

In HAL1, dead time configuration is performed using a single function HAL_HRTIM_DeadTimeConfig, which sets all dead time parameters in one structure.

In HAL2, dead time configuration is split into two APIs: one for setting the dead time configuration and another for locking the dead time settings.

HAL_StatusTypeDef HAL_HRTIM_DeadTimeConfig(HRTIM_HandleTypeDef *hhrtim,
                            uint32_t TimerIdx,
                            const HRTIM_DeadTimeCfgTypeDef *pDeadTimeCfg);
hal_status_t HAL_HRTIM_TIM_SetConfigDeadtime(hal_hrtim_handle_t *hhrtim,
                              uint32_t timer,
                              hal_hrtim_deadtime_t deadtime,
                              const hal_hrtim_deadtime_config_t *p_config);

hal_status_t HAL_HRTIM_TIM_SetLockDeadtime(hal_hrtim_handle_t *hhrtim,
                            uint32_t timer,
                            hal_hrtim_deadtime_t deadtime,
                            hal_hrtim_deadtime_lock_t lock);

Configures HRTIM events.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_EventConfig(HRTIM_HandleTypeDef *hhrtim,
                                        uint32_t Event,
                                        const HRTIM_EventCfgTypeDef *pEventCfg);
hal_status_t HAL_HRTIM_EEV_SetConfig(hal_hrtim_handle_t *hhrtim,
                                     uint32_t event,
                                     const hal_hrtim_eev_config_t *p_config);

Configures event prescaler.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_EventPrescalerConfig(HRTIM_HandleTypeDef *hhrtim,
                                                 uint32_t Prescaler);
hal_status_t HAL_HRTIM_EEV_SetPrescaler(hal_hrtim_handle_t *hhrtim,
                                        hal_hrtim_eev_prescaler_t prescaler);

Configures external event counter.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_ExtEventCounterConfig(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t TimerIdx,
                                                  uint32_t EventCounter,
                                                  const HRTIM_ExternalEventCfgTypeDef *pTimerExternalEventCfg);
hal_status_t HAL_HRTIM_TIM_SetEventCounter(hal_hrtim_handle_t *hhrtim,
                                           uint32_t timer,
                                           hal_hrtim_eev_counter_id_t counter,
                                           const hal_hrtim_eev_counter_config_t *p_config);

Enables external event counter.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_ExtEventCounterEnable(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t TimerIdx,
                                                  uint32_t EventCounter);
hal_status_t HAL_HRTIM_TIM_EnableEventCounter(hal_hrtim_handle_t *hhrtim,
                                              uint32_t timer,
                                              hal_hrtim_eev_counter_id_t counter);

Disables external event counter.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_ExtEventCounterDisable(HRTIM_HandleTypeDef *hhrtim,
                                                   uint32_t TimerIdx,
                                                   uint32_t EventCounter).
hal_status_t HAL_HRTIM_TIM_DisableEventCounter(hal_hrtim_handle_t *hhrtim,
                                               uint32_t timer,
                                               hal_hrtim_eev_counter_id_t evt_counter);

Resets external event counter.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_ExtEventCounterReset(HRTIM_HandleTypeDef *hhrtim,
                                                 uint32_t TimerIdx,
                                                 uint32_t EventCounter);
hal_status_t HAL_HRTIM_TIM_ResetEventCounter(hal_hrtim_handle_t *hhrtim,
                                             uint32_t timer,
                                             hal_hrtim_eev_counter_id_t counter);

Configures and enables fault blanking.

HAL1

HAL2

In HAL1, fault blanking configuration and enabling are performed together in a single function: HAL_HRTIM_FaultBlankingConfigAndEnable.

In HAL2, this functionality is split into two separate APIs one for configuration and one for enabling.

HAL_StatusTypeDef HAL_HRTIM_FaultBlankingConfigAndEnable(HRTIM_HandleTypeDef *hhrtim,
                                                         uint32_t Fault,
                                                         const HRTIM_FaultBlankingCfgTypeDef *pFaultBlkCfg);
hal_status_t HAL_HRTIM_FLT_SetBlanking(hal_hrtim_handle_t *hhrtim,
                                       uint32_t fault,
                                       hal_hrtim_flt_blk_t blanking);

hal_status_t HAL_HRTIM_FLT_EnableBlanking(hal_hrtim_handle_t *hhrtim,
                                          uint32_t fault);

Configures fault inputs.

HAL1

HAL2

In HAL1, fault configuration is performed using a single function HAL_HRTIM_FaultConfig, which sets all fault parameters (source, polarity, filter, and lock) in one structure.

In HAL2, fault configuration is split into two separate APIs: one for setting the fault parameters and another for locking the configuration.

HAL_StatusTypeDef HAL_HRTIM_FaultConfig(HRTIM_HandleTypeDef *hhrtim,
                                        uint32_t Fault,
                                        const HRTIM_FaultCfgTypeDef *pFaultCfg);
hal_status_t HAL_HRTIM_FLT_SetConfig(hal_hrtim_handle_t *hhrtim,
                                     uint32_t fault,
                                     const hal_hrtim_flt_config_t *p_config);

hal_status_t HAL_HRTIM_FLT_Lock(hal_hrtim_handle_t *hhrtim,
                                uint32_t fault);

Configures fault counter.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_FaultCounterConfig(HRTIM_HandleTypeDef *hhrtim,
                                               uint32_t Fault,
                                               const HRTIM_FaultBlankingCfgTypeDef *pFaultBlkCfg);
hal_status_t HAL_HRTIM_FLT_SetCounter(hal_hrtim_handle_t *hhrtim,
                                      uint32_t fault,
                                      const hal_hrtim_flt_counter_config_t *p_config);

Resets fault counter.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_FaultCounterReset(HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t Fault);
hal_status_t HAL_HRTIM_FLT_ResetCounter(hal_hrtim_handle_t *hhrtim,
                                        uint32_t fault);

Controls fault mode.

HAL1

HAL2

In HAL1, enabling or disabling faults is done using a single function depending on an enable/disable parameter.

In HAL2, fault mode control is split into two separate functions:

void HAL_HRTIM_FaultModeCtl(HRTIM_HandleTypeDef *hhrtim,
                            uint32_t Faults,
                            uint32_t Enable);
hal_status_t HAL_HRTIM_FLT_Enable(hal_hrtim_handle_t *hhrtim,
                                  uint32_t fault); /*To enable fault mode*/

hal_status_t HAL_HRTIM_FLT_Disable(hal_hrtim_handle_t *hhrtim,
                                   uint32_t fault); /*To disable fault mode*/

Configures fault prescaler.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_FaultPrescalerConfig(HRTIM_HandleTypeDef *hhrtim,
                                                 uint32_t Prescaler);
hal_status_t HAL_HRTIM_FLT_SetPrescaler(hal_hrtim_handle_t *hhrtim,
                                        hal_hrtim_flt_prescaler_t prescaler);

Gets burst status.

HAL1

HAL2

uint32_t HAL_HRTIM_GetBurstStatus(const HRTIM_HandleTypeDef *hhrtim);
hal_hrtim_burst_mode_operating_status_t HAL_HRTIM_GetBurstModeOperatingStatus(const hal_hrtim_handle_t *hhrtim);

Gets captured value.

HAL1

HAL2

HRTIM_CaptureValueTypeDef HAL_HRTIM_GetCaptured(const HRTIM_HandleTypeDef *hhrtim,
                                                uint32_t TimerIdx,
                                                uint32_t CaptureUnit);
hal_status_t HAL_HRTIM_TIM_GetCapture(const hal_hrtim_handle_t *hhrtim,
                                      uint32_t timer,
                                      hal_hrtim_capture_unit_t capture_unit,
                                      hal_hrtim_capture_t *capture);

Gets capture direction.

HAL1

HAL2

uint32_t HAL_HRTIM_GetCapturedDir(const HRTIM_HandleTypeDef *hhrtim,
                                  uint32_t TimerIdx,
                                  uint32_t CaptureUnit);
hal_hrtim_capture_direction_t HAL_HRTIM_TIM_GetCapturedDirection(const hal_hrtim_handle_t *hhrtim,
                                                                 uint32_t timer,
                                                                 hal_hrtim_capture_unit_t capture_unit);

Gets captured value.

HAL1

HAL2

uint32_t HAL_HRTIM_GetCapturedValue(const HRTIM_HandleTypeDef *hhrtim,
                                    uint32_t TimerIdx,
                                    uint32_t CaptureUnit);
uint16_t HAL_HRTIM_TIM_GetCapturedValue(const hal_hrtim_handle_t *hhrtim,
                                        uint32_t timer,
                                        hal_hrtim_capture_unit_t capture_unit);

Gets current push-pull status.

HAL1

HAL2

uint32_t HAL_HRTIM_GetCurrentPushPullStatus(const HRTIM_HandleTypeDef *hhrtim,
                                            uint32_t TimerIdx);
hal_hrtim_pushpull_current_output_t HAL_HRTIM_TIM_GetPushPullCurrentStatus(const hal_hrtim_handle_t *hhrtim,
                                                                           uint32_t timer);

Gets delayed protection status.

HAL1

HAL2

uint32_t HAL_HRTIM_GetDelayedProtectionStatus(const HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t TimerIdx,
                                              uint32_t Output);
hal_hrtim_output_level_t HAL_HRTIM_OUT_GetDelayedProtectionLevel(const hal_hrtim_handle_t *hhrtim,
                                                                 uint32_t output);

Note

In HAL2, the TimerIdx and Output is no longer a separate parameter; it is now encoded within the output parameter.


Gets idle push-pull status.

HAL1

HAL2

uint32_t HAL_HRTIM_GetIdlePushPullStatus(const HRTIM_HandleTypeDef *hhrtim,
                                         uint32_t TimerIdx);
hal_hrtim_pushpull_idle_output_t HAL_HRTIM_TIM_GetPushPullIdleStatus(const hal_hrtim_handle_t *hhrtim,
                                                                     uint32_t timer);

Gets HRTIM state.

HAL1

HAL2

HAL_HRTIM_StateTypeDef HAL_HRTIM_GetState(const HRTIM_HandleTypeDef *hhrtim);
hal_hrtim_state_t HAL_HRTIM_GetState(const hal_hrtim_handle_t *hhrtim);

Initializes the HRTIM peripheral.

HAL1

HAL2

HAL_HRTIM_Init()
HAL_HRTIM_Init()

De-initializes the HRTIM peripheral.

HAL1

HAL2

HAL_HRTIM_DeInit()
HAL_HRTIM_DeInit()

Initializes HRTIM MSP.

HAL1

HAL2

HAL_HRTIM_MspInit()

Removed


De-initializes HRTIM MSP.

HAL1

HAL2

HAL_HRTIM_MspDeInit()

Removed


Enables output swap.

HAL1

HAL2

In HAL1, enabling output swap can be done using either HAL_HRTIM_OutputSwapEnable or HAL_HRTIM_SwapTimerOutput. Both functions provide the same functionality.

HAL_StatusTypeDef HAL_HRTIM_OutputSwapEnable(HRTIM_HandleTypeDef *hhrtim,
                             uint32_t Timers);

HAL_StatusTypeDef HAL_HRTIM_SwapTimerOutput(HRTIM_HandleTypeDef *hhrtim,
                            uint32_t Timers);

In HAL2, both functions are replaced by a single API:

hal_status_t HAL_HRTIM_TIM_EnableSwapMode(hal_hrtim_handle_t *hhrtim,
                           uint32_t timers)

Disables output swap.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_OutputSwapDisable(HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_DisableSwapMode(hal_hrtim_handle_t *hhrtim,
                                           int32_t timers);

Configures roll over mode.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_RollOverModeConfig(HRTIM_HandleTypeDef *hhrtim,
                                               uint32_t TimerIdx,
                                               uint32_t RollOverCfg);
hal_status_t HAL_HRTIM_TIM_SetRollOverMode(hal_hrtim_handle_t *hhrtim,
                                           uint32_t timer,
                                           hal_hrtim_roll_over_destination_t destination,
                                           hal_hrtim_roll_over_mode_t mode);

Configures time base.

HAL1

HAL2

time_base_config.Period = 0x5;
time_base_config.RepetitionCounter = 0;
time_base_config.PrescalerRatio = HRTIM_PRESCALERRATIO_DIV1;
time_base_config.Mode = HRTIM_MODE_SINGLESHOT_RETRIGGERABLE;
HAL_HRTIM_TimeBaseConfig(&hrtim, HRTIM_TIMERINDEX_TIMER_A, &time_base_config);
time_base_config.Period = 0x5;
time_base_config.repetition = 0;
time_base_config.prescaler = HAL_HRTIM_TIM_PRESCALER_DIV1;
time_base_config.operating_mode = HAL_HRTIM_TIM_MODE_SINGLESHOT_RETRIGGERABLE;
HAL_HRTIM_TIM_SetConfig(&hrtim, HAL_HRTIM_TIMA, &time_base_config);

HAL HRTIM simple functions

HAL1

HAL2

/******************************** Simple time base related functions  *****/

HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStart(HRTIM_HandleTypeDef *hhrtim,
                                            uint32_t TimerIdx);

HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStop(HRTIM_HandleTypeDef *hhrtim,
                                           uint32_t TimerIdx);

HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStart_IT(HRTIM_HandleTypeDef *hhrtim,
                                               uint32_t TimerIdx);

HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStop_IT(HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t TimerIdx);

HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStart_DMA(HRTIM_HandleTypeDef *hhrtim,
                                                uint32_t TimerIdx,
                                                uint32_t SrcAddr,
                                                uint32_t DestAddr,
                                                uint32_t Length);

HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStop_DMA(HRTIM_HandleTypeDef *hhrtim,
                                               uint32_t TimerIdx);

/******************************** Simple output compare related functions  **********/

HAL_StatusTypeDef HAL_HRTIM_SimpleOCChannelConfig(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t TimerIdx,
                                                  uint32_t OCChannel,
                                                  const HRTIM_SimpleOCChannelCfgTypeDef
                                                  *pSimpleOCChannelCfg);

HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart(HRTIM_HandleTypeDef *hhrtim,
                                          uint32_t TimerIdx,
                                          uint32_t OCChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleOCStop(HRTIM_HandleTypeDef *hhrtim,
                                         uint32_t TimerIdx,
                                         uint32_t OCChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_IT(HRTIM_HandleTypeDef *hhrtim,
                                             uint32_t TimerIdx,
                                             uint32_t OCChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleOCStop_IT(HRTIM_HandleTypeDef *hhrtim,
                                            uint32_t TimerIdx,
                                            uint32_t OCChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_DMA(HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t TimerIdx,
                                              uint32_t OCChannel,
                                              uint32_t SrcAddr,
                                              uint32_t DestAddr,
                                              uint32_t Length);

HAL_StatusTypeDef HAL_HRTIM_SimpleOCStop_DMA(HRTIM_HandleTypeDef *hhrtim,
                                             uint32_t TimerIdx,
                                             uint32_t OCChannel);

/******************************** Simple PWM output related functions  ******************/

HAL_StatusTypeDef HAL_HRTIM_SimplePWMChannelConfig(HRTIM_HandleTypeDef *hhrtim,
                                                   uint32_t TimerIdx,
                                                   uint32_t PWMChannel,
                                                   const HRTIM_SimplePWMChannelCfgTypeDef
                                                   *pSimplePWMChannelCfg);

HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart(HRTIM_HandleTypeDef *hhrtim,
                                           uint32_t TimerIdx,
                                           uint32_t PWMChannel);

HAL_StatusTypeDef HAL_HRTIM_SimplePWMStop(HRTIM_HandleTypeDef *hhrtim,
                                          uint32_t TimerIdx,
                                          uint32_t PWMChannel);

HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_IT(HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t TimerIdx,
                                              uint32_t PWMChannel);

HAL_StatusTypeDef HAL_HRTIM_SimplePWMStop_IT(HRTIM_HandleTypeDef *hhrtim,
                                             uint32_t TimerIdx,
                                             uint32_t PWMChannel);

HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef *hhrtim,
                                               uint32_t TimerIdx,
                                               uint32_t PWMChannel,
                                               uint32_t SrcAddr,
                                               uint32_t DestAddr,
                                               uint32_t Length);

HAL_StatusTypeDef HAL_HRTIM_SimplePWMStop_DMA(HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t TimerIdx,
                                              uint32_t PWMChannel);

/******************************** Simple capture related functions  *****************/

HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureChannelConfig(HRTIM_HandleTypeDef *hhrtim,
                                                       uint32_t TimerIdx,
                                                       uint32_t CaptureChannel,
                                          const HRTIM_SimpleCaptureChannelCfgTypeDef
                                          *pSimpleCaptureChannelCfg);

HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart(HRTIM_HandleTypeDef *hhrtim,
                                               uint32_t TimerIdx,
                                               uint32_t CaptureChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop(HRTIM_HandleTypeDef *hhrtim,
                                              uint32_t TimerIdx,
                                              uint32_t CaptureChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart_IT(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t TimerIdx,
                                                  uint32_t CaptureChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop_IT(HRTIM_HandleTypeDef *hhrtim,
                                                 uint32_t TimerIdx,
                                                 uint32_t CaptureChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart_DMA(HRTIM_HandleTypeDef *hhrtim,
                                                   uint32_t TimerIdx,
                                                   uint32_t CaptureChannel,
                                                   uint32_t SrcAddr,
                                                   uint32_t DestAddr,
                                                   uint32_t Length);

HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop_DMA(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t TimerIdx,
                                                  uint32_t CaptureChannel);

/******************************** Simple one pulse related functions  ******************/

HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseChannelConfig(HRTIM_HandleTypeDef *hhrtim,
                                                        uint32_t TimerIdx,
                                                        uint32_t OnePulseChannel,
                                     const HRTIM_SimpleOnePulseChannelCfgTypeDef
                                     *pSimpleOnePulseChannelCfg);

HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStart(HRTIM_HandleTypeDef *hhrtim,
                                                uint32_t TimerIdx,
                                                uint32_t OnePulseChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStop(HRTIM_HandleTypeDef *hhrtim,
                                               uint32_t TimerIdx,
                                               uint32_t OnePulseChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStart_IT(HRTIM_HandleTypeDef *hhrtim,
                                                   uint32_t TimerIdx,
                                                   uint32_t OnePulseChannel);

HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStop_IT(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t TimerIdx,
                                                  uint32_t OnePulseChannel);
  • The HAL_HRTIM_Simple functions from HAL 1, which mimicked HAL_TIM functions, removed in HAL2. However, you can still achieve the same functionality using the HAL HRTIM API, For more details, refer to

Triggers software capture.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_SoftwareCapture(HRTIM_HandleTypeDef *hhrtim,
                                            uint32_t TimerIdx,
                                            uint32_t CaptureUnit);
hal_status_t HAL_HRTIM_TIM_Capture(hal_hrtim_handle_t *hhrtim,
                                   uint32_t timer,
                                   hal_hrtim_capture_unit_t capture_unit);

Triggers software reset.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_SoftwareReset(HRTIM_HandleTypeDef *hhrtim,
                                          uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_Reset(hal_hrtim_handle_t *hhrtim,
                                 uint32_t timers);

Triggers software update.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_SoftwareUpdate(HRTIM_HandleTypeDef *hhrtim,
                                           uint32_t Timers);
hal_status_t HAL_HRTIM_Update(hal_hrtim_handle_t *hhrtim,
                                  uint32_t timers);

Configures dual channel DAC for timer.

HAL1

HAL2

In HAL1, dual channel DAC configuration for a timer is performed using a single function HAL_HRTIM_TimerDualChannelDacConfig, which takes a configuration structure as a parameter.

In HAL2, dual channel DAC configuration is split into separate APIs: one for setting the DAC triggers and others for enabling or disabling the dual channel DAC.

HAL_StatusTypeDef HAL_HRTIM_TimerDualChannelDacConfig(HRTIM_HandleTypeDef *hhrtim,
                                                      uint32_t TimerIdx,
                                                      const HRTIM_TimerCtlTypeDef *pTimerCtl);
hal_status_t HAL_HRTIM_TIM_SetDualChannelDACTriggers(hal_hrtim_handle_t *hhrtim,
                                                     uint32_t timer,
                                                     const hal_hrtim_dual_channel_dac_triggers_config_t *p_config);

hal_status_t HAL_HRTIM_TIM_EnableDualChannelDAC(hal_hrtim_handle_t *hhrtim,
                                                uint32_t timer);

hal_status_t HAL_HRTIM_TIM_DisableDualChannelDAC(hal_hrtim_handle_t *hhrtim,
                                                 uint32_t timer);

Configures timer event filtering.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_TimerEventFilteringConfig(HRTIM_HandleTypeDef *hhrtim,
                                                      uint32_t TimerIdx,
                                                      uint32_t Event,
                                                      const HRTIM_TimerEventFilteringCfgTypeDef *pTimerEventFilteringCfg);
hal_status_t HAL_HRTIM_TIM_SetEventFilter(hal_hrtim_handle_t *hhrtim,
                                          uint32_t timer,
                                          uint32_t event,
                                          const hal_hrtim_eev_filter_config_t *p_config);

Disables update event.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_UpdateDisable(HRTIM_HandleTypeDef *hhrtim,
                                          uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_DisableUpdate(hal_hrtim_handle_t *hhrtim,
                                         uint32_t timers);

Enables update event.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_UpdateEnable(HRTIM_HandleTypeDef *hhrtim,
                                         uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_EnableUpdate(hal_hrtim_handle_t *hhrtim,
                                        uint32_t timers);

Configures waveform capture.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformCaptureConfig(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t TimerIdx,
                                                  uint32_t CaptureUnit,
                                                  const HRTIM_CaptureCfgTypeDef *pCaptureCfg);
hal_status_t HAL_HRTIM_TIM_SetCaptureTrigger(hal_hrtim_handle_t *hhrtim,
                                             uint32_t timer,
                                             hal_hrtim_capture_unit_t capture_unit,
                                             uint64_t triggers);

Configures waveform compare.

HAL1

HAL2

In HAL1, the compare unit configuration, including compare value and auto-delayed mode, is done with a single function using one structure that holds all settings.

In HAL2, this function is split into two separate APIs: one to set the compare value, and another to configure the auto-delayed mode.

HAL_StatusTypeDef HAL_HRTIM_WaveformCompareConfig(HRTIM_HandleTypeDef *hhrtim,
                                                  uint32_t TimerIdx,
                                                  uint32_t CompareUnit,
                                                  const HRTIM_CompareCfgTypeDef *pCompareCfg);
hal_status_t HAL_HRTIM_TIM_SetCompareValue(hal_hrtim_handle_t *hhrtim,
                                           uint32_t timer,
                                           hal_hrtim_compare_unit_t compare_unit,
                                           uint16_t compare_value);

hal_status_t HAL_HRTIM_TIM_SetAutoDelayedMode(hal_hrtim_handle_t *hhrtim,
                                              uint32_t timer,
                                              hal_hrtim_compare_unit_t compare_unit,
                                              const hal_hrtim_auto_delayed_config_t *p_config);

Starts waveform count.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart(HRTIM_HandleTypeDef *hhrtim,
                                                 uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_Start(hal_hrtim_handle_t *hhrtim,
                                 uint32_t timers);

Starts waveform count with interrupt.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart_IT(HRTIM_HandleTypeDef *hhrtim,
                                                    uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_Start_IT(hal_hrtim_handle_t *hhrtim,
                                    uint32_t timers);

Starts waveform count with DMA.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart_DMA(HRTIM_HandleTypeDef *hhrtim,
                                                     uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_Start_DMA(hal_hrtim_handle_t *hhrtim,
                                     uint32_t timers);

Stops waveform count.

HAL1

HAL2

HAL_StatusTypeDef  HAL_HRTIM_WaveformCountStop(HRTIM_HandleTypeDef *hhrtim,
                                                 uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_Stop(hal_hrtim_handle_t *hhrtim,
                                uint32_t timers);

Stops waveform count with DMA.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformCountStop_DMA(HRTIM_HandleTypeDef *hhrtim,
                                                    uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_Stop_DMA(hal_hrtim_handle_t *hhrtim,
                                    uint32_t timers);

Stops waveform count with interrupt.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformCountStop_IT(HRTIM_HandleTypeDef *hhrtim,
                                                   uint32_t Timers);
hal_status_t HAL_HRTIM_TIM_Stop_IT(hal_hrtim_handle_t *hhrtim,
                                   uint32_t timers);

Gets waveform output level.

HAL1

HAL2

uint32_t HAL_HRTIM_WaveformGetOutputLevel(const HRTIM_HandleTypeDef *hhrtim,
                                          uint32_t TimerIdx,
                                          uint32_t Output);
hal_hrtim_output_level_t HAL_HRTIM_OUT_GetRawLevel(const hal_hrtim_handle_t *hhrtim,
                                                   uint32_t output);

Note

In HAL2, the TimerIdx and Output is no longer a separate parameter; it is now encoded within the output parameter.


Gets waveform output state.

HAL1

HAL2

uint32_t HAL_HRTIM_WaveformGetOutputState(const HRTIM_HandleTypeDef *hhrtim,
                                          uint32_t TimerIdx,
                                          uint32_t Output);
hal_hrtim_output_state_t HAL_HRTIM_OUT_GetState(const hal_hrtim_handle_t *hhrtim,
                                                uint32_t output);

Note

In HAL2, the TimerIdx and Output is no longer a separate parameter; it is now encoded within the output parameter.


Configures waveform output.

HAL1

HAL2

In HAL1, output configuration is done using a single API HAL_HRTIM_WaveformOutputConfig with a configuration structure that sets all output parameters, burst mode, and chopper mode together.

In HAL2, the configuration is split into separate APIs for better modularity and clarity:

HAL_StatusTypeDef HAL_HRTIM_WaveformOutputConfig(HRTIM_HandleTypeDef *hhrtim,
                                                 uint32_t TimerIdx,
                                                 uint32_t Output,
                                                 const HRTIM_OutputCfgTypeDef *pOutputCfg);
/*to configure output parameters*/
hal_status_t HAL_HRTIM_OUT_SetConfig(hal_hrtim_handle_t *hhrtim,
                                     uint32_t output,
                                     const hal_hrtim_output_config_t *p_config);

/*to configure burst mode*/
hal_status_t HAL_HRTIM_OUT_SetBurstMode(hal_hrtim_handle_t *hhrtim,
                                        uint32_t output,
                                        hal_hrtim_output_burst_mode_t output_burst_mode);

/*to enable or disable chopper mode*/
hal_status_t HAL_HRTIM_TIM_EnableChopper(hal_hrtim_handle_t *hhrtim,
                               uint32_t timer,
                               hal_hrtim_tim_outputs_t outputs);

hal_status_t HAL_HRTIM_TIM_DisableChopper(hal_hrtim_handle_t *hhrtim,
                                          uint32_t timer,
                                          hal_hrtim_tim_outputs_t outputs);

Note

In HAL2, the TimerIdx and Output is no longer a separate parameter; it is now encoded within the output parameter.


Starts waveform output.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformOutputStart(HRTIM_HandleTypeDef *hhrtim,
                                                uint32_t OutputsToStart);
hal_status_t HAL_HRTIM_OUT_Enable(hal_hrtim_handle_t *hhrtim,
                                  uint32_t outputs);

Stops waveform output.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformOutputStop(HRTIM_HandleTypeDef *hhrtim,
                                               uint32_t OutputsToStop);
hal_status_t HAL_HRTIM_OUT_Disable(hal_hrtim_handle_t *hhrtim,
                                   uint32_t outputs);

Sets waveform output level.

HAL1

HAL2

In HAL1, the function HAL_HRTIM_WaveformSetOutputLevel sets the output level (active or inactive) by specifying the desired OutputLevel parameter.

In HAL2, this functionality is provided by two distinct APIs for setting the output to either the active or inactive level.

HAL_StatusTypeDef HAL_HRTIM_WaveformSetOutputLevel(HRTIM_HandleTypeDef *hhrtim,
                                  uint32_t TimerIdx,
                                  uint32_t Output,
                                  uint32_t OutputLevel);
/* Set the output to the active level */
hal_status_t HAL_HRTIM_OUT_Set(hal_hrtim_handle_t *hhrtim,
                    uint32_t output);

/* Set the output to the inactive level */
hal_status_t HAL_HRTIM_OUT_Reset(hal_hrtim_handle_t *hhrtim,
                      uint32_t output);

Note

In HAL2, the TimerIdx and Output is no longer a separate parameter; it is now encoded within the output parameter.


Configures waveform timer.

HAL1

HAL2

HAL_StatusTypeDef HAL_HRTIM_WaveformTimerConfig(HRTIM_HandleTypeDef *hhrtim,
                                                uint32_t TimerIdx,
                                                const HRTIM_TimerCfgTypeDef *pTimerCfg);

In HAL2, the API HAL_HRTIM_WaveformTimerConfig is split into several unitary APIs.

For more details, refer to HRTIM_TimerCfgTypeDef migration

/* Interrupts configuration */
hal_status_t HAL_HRTIM_SetConfigInterrupts(hal_hrtim_handle_t *hhrtim, hal_hrtim_interrupt_src_t source, uint32_t interrupts);


/* DMA configuration */
hal_status_t HAL_HRTIM_SetConfigDMA(hal_hrtim_handle_t *hhrtim,
                                    hal_hrtim_dma_source_t source,
                                    hal_hrtim_dma_config_t *p_config);


/* Synchronous start/reset enabling */
hal_status_t HAL_HRTIM_TIM_SetSlaveMode(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_tim_slave_mode_t slave_mode);


/* DAC synchronization mode selection  */
hal_status_t HAL_HRTIM_TIM_SetDACTrigger(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_dac_trigger_t dac_trigger);

/* Registers preload enabling/disabling  */
hal_status_t HAL_HRTIM_TIM_EnablePreload(hal_hrtim_handle_t *hhrtim,uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisablePreload(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Update gating mode selection */
hal_status_t HAL_HRTIM_TIM_SetUpdateGating(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_update_gating_t update_gating);

/* Set the interleaved mode of a timer. */
hal_status_t HAL_HRTIM_TIM_SetInterleavedMode(hal_hrtim_handle_t *hhrtim,
                                      uint32_t timer,
                                      hal_hrtim_interleaved_mode_t mode);

/* Enable balanced idle automatic resume. */
hal_status_t HAL_HRTIM_TIM_EnableBalancedIdleAutoResume(hal_hrtim_handle_t *hhrtim,
                                                uint32_t timer);

/* Disable balanced idle automatic resume. */
hal_status_t HAL_HRTIM_TIM_DisableBalancedIdleAutoResume(hal_hrtim_handle_t *hhrtim,
                                                uint32_t timer);

/* Enable the re-synchronized update mode for a timer. */
hal_status_t HAL_HRTIM_EnableUpdateResync(hal_hrtim_handle_t *hhrtim,
                                                uint32_t timer);

/* Disable the re-synchronized update mode for a timer. */
hal_status_t HAL_HRTIM_DisableUpdateResync(hal_hrtim_handle_t *hhrtim,
                                                uint32_t timer);

/* Burst mode selection */
hal_status_t HAL_HRTIM_TIM_SetBurstMode(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_timer_burst_mode_t timer_burst_mode);

/* Update on repetition enabling */
hal_status_t HAL_HRTIM_TIM_SetRepetition(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint16_t repetition);

/*Push-pull mode enabling/disabling*/
hal_status_t HAL_HRTIM_TIM_EnablePushPull(hal_hrtim_handle_t *hhrtim, uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisablePushPull(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Fault inputs enabling/disabling */
hal_status_t HAL_HRTIM_TIM_EnableFault(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint32_t faults);
hal_status_t HAL_HRTIM_TIM_DisableFault(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint32_t faults);

/* Fault lock selection */
hal_status_t HAL_HRTIM_TIM_LockFault(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Deadtime insertion enabling / disabling */
hal_status_t HAL_HRTIM_TIM_EnableDeadtime(hal_hrtim_handle_t *hhrtim, uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisableDeadtime(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Delayed protection mode selection */
hal_status_t HAL_HRTIM_TIM_EnableDelayedProtection(hal_hrtim_handle_t *hhrtim,uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisableDelayedProtection(hal_hrtim_handle_t *hhrtim, uint32_t timer);
hal_status_t HAL_HRTIM_TIM_SetConfigDelayedProtection(hal_hrtim_handle_t *hhrtim, uint32_t timer,
                                                      const hal_hrtim_delayed_prot_config_t *p_config);

/* Update trigger selection and update on counter reset enabling */
hal_status_t HAL_HRTIM_TIM_SetUpdateSource(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint32_t update_source);
hal_status_t HAL_HRTIM_TIM_SetResetSource(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint32_t reset_sources);

Controls waveform timer.

HAL1

HAL2

In HAL1, the HAL_HRTIM_WaveformTimerControl function provides a single entry point to configure and control various timer features using a unified structure.

In HAL2, this functionality is split into multiple, more granular APIs. Each API targets a specific aspect of timer control, such as setting the counting mode, enabling triggered half mode, configuring dual channel DAC, or managing compare units. For more details, refer to HRTIM_TimerCtlTypeDef migration

HAL_StatusTypeDef HAL_HRTIM_WaveformTimerControl(HRTIM_HandleTypeDef *hhrtim,
                                                uint32_t TimerIdx,
                                                const HRTIM_TimerCtlTypeDef *pTimerCtl);
/* Timer counter mode */
hal_status_t HAL_HRTIM_TIM_SetCountingMode(hal_hrtim_handle_t *hhrtim,
                                           uint32_t timer,
                                           hal_hrtim_timer_counting_mode_t counting_mode);

/* Triggered half mode */
hal_status_t HAL_HRTIM_TIM_SetTriggeredHalfMode(hal_hrtim_handle_t *hhrtim,
                                                uint32_t timer,
                                                hal_hrtim_trig_half_mode_t mode);

/* Greater than compare */
hal_status_t HAL_HRTIM_TIM_EnableGTCompare(hal_hrtim_handle_t *hhrtim,
                                           uint32_t timer,
                                           hal_hrtim_compare_unit_t compare_unit);
hal_status_t HAL_HRTIM_TIM_DisableGTCompare(hal_hrtim_handle_t *hhrtim,
                                            uint32_t timer,
                                            hal_hrtim_compare_unit_t compare_unit);

/* Dual channel DAC configuration */
hal_status_t HAL_HRTIM_TIM_SetDualChannelDACTriggers(hal_hrtim_handle_t *hhrtim,
                                             uint32_t timer,
                                             const hal_hrtim_dual_channel_dac_triggers_config_t *p_config);

hal_status_t HAL_HRTIM_TIM_EnableDualChannelDAC(hal_hrtim_handle_t *hhrtim,
                                                uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisableDualChannelDAC(hal_hrtim_handle_t *hhrtim,
                                                 uint32_t timer);